package com.sbp.message.proxy;

import com.dap.utils.SpringUtils;

import java.lang.reflect.Proxy;

/**
 * 创建代理
 *
 */
public class MessageInvoker {
   
    public static Object getInstance(Class<?> cls){        
        MessageProxy invocationHandler = SpringUtils.getBean(MessageProxy.class);
        Object newInstance = Proxy.newProxyInstance(  
                cls.getClassLoader(),  
                new Class[] { cls }, 
                invocationHandler); 
        return newInstance;
    }
}